import Vue from 'vue'
import Router from 'vue-router'
import Home from './views'
const GroupChat = () => import(/* webpackChunkName: "chat" */ './views/groupChat')
const FriendChat = () => import(/* webpackChunkName: "chat" */ './views/friendChat')
const ChatList = () => import(/* webpackChunkName: "chatList" */ './views/chatList')
const GroupChatList = () => import(/* webpackChunkName: "groupChatList" */ './views/groupList')
const Mine = () => import(/* webpackChunkName: "mine" */ './views/mine')
const PeronInfo = () => import(/* webpackChunkName: "mine" */ './views/mine/personInfo')
const AccountSet = () => import(/* webpackChunkName: "mine" */ './views/mine/accountSet')
const AboutUs = () => import(/* webpackChunkName: "mine" */ './views/mine/accountSet/AboutUs')
const PointRecords = () => import(/* webpackChunkName: "mine" */ './views/mine/accountSet/PointRecords')
const Login = () => import(/* webpackChunkName: "login" */ './views/login')
const GroupInfo = () => import(/* webpackChunkName: "member" */ './views/groupInfo')
const EditName = () => import(/* webpackChunkName: "FixName" */ './views/editName')
const GroupNotice = () => import(/* webpackChunkName: "maxCard" */ './views/groupNotice')
const GroupHistory = () => import(/* webpackChunkName: "chatHistory" */ './views/groupHistory')
const UpdatePassWord = () => import(/* webpackChunkName: "updatePwd" */ './views/changePwd')
const Remarks = () => import(/* webpackChunkName: "remarks" */ './views/remarks')

Vue.use(Router)

let routes = [
  {
    path: '/',
    name: 'home',
    component: Home,
    redirect: '/chatList',
    children: [
      { path: '/login', name: '登录', component: Login },
      { path: '/groupHistory', name: '群聊历史', component: GroupHistory },
      { path: '/groupInfo', name: '群聊详情', component: GroupInfo },
      { path: '/chatList', name: '聊天', component: ChatList },
      { path: '/groupList', name: '群聊', component: GroupChatList },
      { path: '/mine', name: '我的', component: Mine },
      { path: '/pointRecords', name: '积分纪录', component: PointRecords },
      { path: '/aboutUs', name: '关于我们', component: AboutUs },
      { path: '/peronInfo', name: '个人信息', component: PeronInfo },
      { path: '/accountSet', name: '账户设置', component: AccountSet },
      { path: '/groupChat', name: '群聊天', component: GroupChat },
      { path: '/editName/:method', name: '编辑名称', component: EditName },
      { path: '/groupNotice/:groupId', name: '群公告', component: GroupNotice },
      { path: '/friendChat', name: '好友聊天', component: FriendChat },
      { path: '/changePwd/:id', name: '修改密码', component: UpdatePassWord },
      { path: '/remarks', name: '用户详情', component: Remarks }
    ]
  }
]

export default new Router({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})
